//
//  UIView+XKLine.m
//  XKStudyDemo
//
//  Created by xukai on 2017/11/30.
//  Copyright © 2017年 xukai. All rights reserved.
//

#import "UIView+XKLine.h"

@implementation UIView (XKLine)

-(void) drawLineWithSpoint:(CGPoint) sPoint ePoint:(CGPoint) ePoint W:(CGFloat) W colour:(UIColor *) colour{
    CAShapeLayer *solidShapeLayer = [CAShapeLayer layer];
    CGMutablePathRef solidShapePath =  CGPathCreateMutable();
    [solidShapeLayer setFillColor:[[UIColor clearColor] CGColor]];
    [solidShapeLayer setStrokeColor:[colour CGColor]];
    solidShapeLayer.lineWidth = W ;
    CGPathMoveToPoint(solidShapePath, NULL, sPoint.x, sPoint.y);
    CGPathAddLineToPoint(solidShapePath, NULL,ePoint.x, ePoint.y);
    [solidShapeLayer setPath:solidShapePath];
    CGPathRelease(solidShapePath);
    [self.layer addSublayer:solidShapeLayer];
}


@end
